﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;

namespace DAL.CashManagerDAL
{
    public class CMLostCashDAL
    {
        string ConnString = ConfigurationManager.ConnectionStrings["AMIE_DB"].ToString();

        public CMLostCashDAL() { }

        public DataTable LoadCMLostCashDAL()
        {
            SqlConnection conn = new SqlConnection(ConnString);

            SqlCommand command = new SqlCommand("STP_LoadCMLostCash", conn);

            SqlDataAdapter adapter = new SqlDataAdapter(command);

            adapter.SelectCommand.CommandType = CommandType.StoredProcedure;

            DataSet dSet = new DataSet();
            try
            {
                conn.Open();

                adapter.Fill(dSet);

                return dSet.Tables[0];
            }
            catch
            {
                throw;
            }
            finally
            {
                dSet.Dispose();         // Dispose dataset

                adapter.Dispose();      // Dispose adapter

                conn.Close();           // Close connection                    

                conn.Dispose();         // Dispose connection
            }
        }
    }
}
